package mumu.android.view;

import mumu.android.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.AnimationDrawable;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;

public class loading1 extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("mumu.android.view.loading1");
		setContentView(R.layout.loading1);
		ImageView img = (ImageView) findViewById(R.id.img_1);
		img.setImageResource(R.drawable.loading);
		final AnimationDrawable ad = (AnimationDrawable) img.getDrawable();
		//动态开启
		// img.getViewTreeObserver().addOnPreDrawListener(new
		// OnPreDrawListener() {
		//
		// @Override
		// public boolean onPreDraw() {
		// ad.start();
		// return true;
		// }
		//
		// });
		
		findViewById(R.id.btn_1).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (ad.isRunning())
					ad.stop();
				else
					ad.start();
			}
		});
	}

}
